<h1>Listing equipment</h1>

<table>
  <tr>
    <th>Name</th>
	<th>Status</th>
	<th>Manager</th>
	<th>Handlers</th>
    <th></th>
    <th></th>
    <th></th>
  </tr>

<% @equipment.each do |equipment| %>
  <tr>
    <td><%= equipment.name %></td>
	<td style="color:<%=equipment.status.color%>">
		<b><%= equipment.status.name %></b>
	</td>
	<td><b><%= link_to(equipment.manager.name, equipment.manager) %></b></td>
	<td><b>
		<% equipment.handlers.each do |handler| %>
			|<%= link_to(handler.name, handler) %>|
		<% end %>
		<em><%= "No Handlers" if equipment.handlers.size < 1%></em>
	</b></td>
    <td><%= link_to 'Show', equipment %></td>
    <td><%= link_to 'Edit', edit_equipment_path(equipment) %></td>
    <td><%= link_to 'Destroy', equipment, method: :delete, data: { confirm: 'Are you sure?' } %></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'Home', root_path %> |
<%= link_to 'New Equipment', new_equipment_path %>
